package com.logistics.container.entity.model;

import com.logistics.container.entity.domian.Container;
import com.logistics.utils.aspect.annotation.Dictionary;
import com.logistics.utils.tool.DateUtils;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class ContainerRow {

  private Integer id;

  private Integer pickContainerId;

  private String code;

  private String showName;

  private String name;

  @Dictionary(key = "container_type")
  private String type;

  private BigDecimal height;

  private String station;

  private String creator;

  private String createTime;

  private String updater;

  private String updateTime;

  public ContainerRow() {
  }

  public ContainerRow(Container container) {
    this.id = container.getId();
    this.code = container.getCode();
    this.name = container.getName();
    this.type = container.getType();
    this.height = container.getHeight();
    this.creator = container.getCreator();
    this.createTime = DateUtils.dateToStringFormat(container.getCreateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
    this.updater = container.getUpdater();
    this.updateTime = DateUtils.dateToStringFormat(container.getUpdateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
  }

  public static ContainerRow build(Container container){
    return new ContainerRow(container);
  }
}
